export function addSubscribition(subscribtion, callback) {
  subscribtion.push(callback)
  return function(subscribtion, callback){
    let idx = subscribtion.indexOf(callback)
    if (idx>-1) {
      subscribtion.splice(idx, 1)
    }
  }
}

export function triggersubscribtion(subscribtion,...args) {
  subscribtion.slice().forEach((item) => {
    item(...args)
  })
}

//发布和订阅